package ACM.meituan2;

/**
 * @Author wwk
 * @DATE 2022/8/27 16:01
 */
import java.util.*;
public class first {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();  //字符串S的长度
        int m = scanner.nextInt();  //字符串s 的长度
        String S = scanner.next();
        String s = scanner.next();
        char c = s.charAt(0);
        int count = 0;
        //*在中间
        if(c!='*'){
            for (int i = 0; i < n-m+1; i++){
                //首字符相等
                if(S.charAt(i) == c){
                    //符合计数加一
                    if(valid(S.substring(i,i+m),s)){
                        count++;
                    }
                }
            }
        }else{
            //*再开头
            for (int i = 0; i < n-m; i++){
                //符合计数加一
                if(valid(S.substring(i,i+m),s)){
                    count++;
                }
            }
        }

        System.out.println(count);
    }

    //判断两个字符串是否匹配
    private static boolean valid(String s1, String s2){
        if(s1.equals(s2)){
            return true;
        }
        for(int i=0;i<s1.length();i++){
            if(s2.charAt(i)=='*'){
                continue;
            }
            if(s1.charAt(i) != s2.charAt(i)){
                return false;
            }
        }
        return true;
    }
}
